﻿using Device.Domain;
using Device.Infrstructre.Interface;
using Device.Read.API.Applcation.Command.CarriersCommand;
using MediatR;

namespace Device.Read.API.Applcation.CommandHandlers.CarriersCommandHandlers
{
    /// <summary>
    /// 反填承运商中介者
    /// </summary>
    public class FanCarriersModelCommandHandler:IRequestHandler<FanCarriersModelCommand,CarriersModel>
    {
        private readonly ICarrierRepository _carrierRepository;

        public FanCarriersModelCommandHandler(ICarrierRepository carrierRepository)
        {
            _carrierRepository = carrierRepository;
        }

        public async Task<CarriersModel> Handle(FanCarriersModelCommand request, CancellationToken cancellationToken)
        {
            return await _carrierRepository.GetModelAsync(request.id);
        }
    }
}
